package com.fileshare.web.dao;

import com.fileshare.web.entity.Authority;
import com.fileshare.web.entity.Role;
import com.fileshare.web.entity.User;
import com.fileshare.web.entity.UserRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RoleRepository {
    List<UserRole> getUserRoles(User dbUser);

    Role getRoleByUserRole(UserRole userRole);

    void save(Role role);

    void deleteByRoleId(Integer id);

    void update(Role role);

    List<Role> findAllRoles();

    Role findById(Integer id);

    List<Role> findUserRoles(Integer userId);

    Role getRoleByUserRoleName(@Param("roleName") String roleName);

    void addUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);

    void deleteUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);

    void addRoleAuthority(Integer roleId, Integer id);
}
